/* ppp_ctrl.h
**
** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License"); 
** you may not use this file except in compliance with the License. 
** You may obtain a copy of the License at 
**
**     http://www.apache.org/licenses/LICENSE-2.0 
**
** Unless required by applicable law or agreed to in writing, software 
** distributed under the License is distributed on an "AS IS" BASIS, 
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
** See the License for the specific language governing permissions and 
** limitations under the License.
*/

/** returns 1 if line starts with prefix, 0 if it does not */

#ifndef PPP_CTRL_H
#define PPP_CTRL_H

struct _PppCtrl;
typedef struct _PppCtrl PppCtrl;

typedef enum _PppState
{
	PPP_STATE_IDLE,
	PPP_STATE_DOWN,
	PPP_STATE_UP,
	PPP_STATE_USB_AVAILABLE,
	PPP_STATE_USB_UNAVIALABLE
}PppState;

typedef void (*OnPppStateChangedFunc)(PppCtrl* thiz, PppState state, void* user_data);
typedef void (*OnUeventFunc)(PppCtrl* thiz, const char* buffer, void* user_data);

PppCtrl* 	ppp_ctrl_create(OnPppStateChangedFunc onStateChanged, void* user_data);
PppCtrl*    ppp_ctrl_create_with_thread(OnPppStateChangedFunc onStateChanged, void* user_data);
void		ppp_ctrl_destroy(PppCtrl* thiz);

PppState 	ppp_ctrl_get_state(PppCtrl* thiz);
void		ppp_ctrl_start_pppd(PppCtrl* thiz, const char* device, 
				const char* user, const char* pwd, int authtype);
void        ppp_ctrl_start_pppd_with_call(PppCtrl* thiz, const char* device,
                const char* user, const char* pwd, const char* number, int authtype);
void		ppp_ctrl_stop_pppd(PppCtrl* thiz);
char* ppp_ctrl_get_dev_name(PppCtrl* thiz);
void ppp_ctrl_set_uevent_listener(PppCtrl* thiz, OnUeventFunc onUevent, void* user_data);

#endif


